package com.cloudkinto.common;

import com.cloudkinto.entity.FbaStorageDo;
import com.cloudkinto.entity.ProductInfoDo;
import com.cloudkinto.entity.ShippingAddressDo;
import com.cloudkinto.extentity.OrderOutputExportDto;
import com.cloudkinto.extentity.SerialNumberPageDto;
import com.cloudkinto.extentity.StockRecordNewDto;
import com.cloudkinto.extentity.StockSnapshotPageDto;
import com.cloudkinto.service.fbaorderoutput.vo.FbaOrderOutputComputationalCostsReq;
import com.cloudkinto.service.finance.vo.exportVo.*;
import com.cloudkinto.service.orderback.vo.OrderBackDetailExportVo;
import com.cloudkinto.service.orderback.vo.OrderBackPageRes;
import com.cloudkinto.service.orderinput.vo.InputMarkProduct;
import com.cloudkinto.service.qianyi.vo.QianyiInventoryResponse;
import com.cloudkinto.service.serialmanage.vo.SerialNumberExportVo;
import com.cloudkinto.service.shipprice.vo.FbaComputerPriceReq;
import com.cloudkinto.service.stock.StockSnapshotExportVo;
import com.cloudkinto.service.stock.vo.ShippingAddressAddReq;
import com.cloudkinto.service.stock.vo.ShippingAddressDetailRes;
import com.cloudkinto.service.stock.vo.ShippingAddressUpdateReq;
import com.cloudkinto.service.stock.vo.log.StockLogExportVo;
import com.cloudkinto.service.stock.vo.log.StockLogPageRes;
import com.cloudkinto.service.stock.vo.record.StockRecordPageRes;
import com.cloudkinto.service.storage.vo.FbaStorageAddReq;
import com.cloudkinto.service.storage.vo.FbaStoragePageRes;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @author zhujiale
 * @description 对象拷贝公共
 * @date 2022/9/19
 */
@Mapper
public interface BeanConvert {
    BeanConvert INSTANCE = Mappers.getMapper(BeanConvert.class);
    /**
     *示例
     *@param UserDo source
     *@result UserDto target
     */
    //@Mapping(source = "userName", target = "userNameCN")
    //UserDto userDto(UserDo userDo);

    /****************************Ding******************************/


    /****************************Hua******************************/


    /****************************Zhu******************************/
    //运费试算-FBA试算
    FbaOrderOutputComputationalCostsReq fbaOrderOutputComputationalCostsReq(FbaComputerPriceReq req);

    //新增FBA仓库
    FbaStorageDo fbaStorageDo(FbaStorageAddReq req);

    //FBA仓库分页返回
    FbaStoragePageRes fbaStoragePageRes(FbaStorageDo fbaStorageDo);

    //收货地址新增
    ShippingAddressDo shippingAddressDo(ShippingAddressAddReq req);

    //收货地址修改
    ShippingAddressDo shippingAddressUpdateDo(ShippingAddressUpdateReq req);

    //收货地址详情
    ShippingAddressDetailRes shippingAddressDetailRes(ShippingAddressDo addressDo);

    //库存快照导出excel
    StockSnapshotExportVo stockSnapshotExportVo(StockSnapshotPageDto dto);

    //序列号管理导出excel
    SerialNumberExportVo serialNumberExportVo(SerialNumberPageDto dto);

    StockLogExportVo stockLogExportVo(StockLogPageRes et);

    @Mappings({@Mapping(source = "stockRecordPageRes.commoditySku", target = "warehouseSku"),
            @Mapping(source = "stockRecordPageRes.storage", target = "warehouseCode"),
            @Mapping(source = "stockRecordPageRes.canSellCount", target = "totalQuantity"),
            @Mapping(source = "stockRecordPageRes.canotSellCount", target = "unsellableQuantity"),
            @Mapping(source = "stockRecordPageRes.inTransit", target = "onwayQuantity"),
            @Mapping(source = "stockRecordPageRes.noDelivered", target = "reservedQuantity")})
    QianyiInventoryResponse stockRecord2QainyiInventory(StockRecordPageRes stockRecordPageRes);

    @Mappings({@Mapping(source = "stockRecordPageRes.commoditySku", target = "warehouseSku"),
            @Mapping(source = "stockRecordPageRes.storageCode", target = "warehouseCode"),
            @Mapping(source = "stockRecordPageRes.canSellCount", target = "totalQuantity"),
            @Mapping(source = "stockRecordPageRes.canotSellCount", target = "unsellableQuantity"),
            @Mapping(source = "stockRecordPageRes.inTransit", target = "onwayQuantity"),
            @Mapping(source = "stockRecordPageRes.toSend", target = "reservedQuantity")})
    QianyiInventoryResponse stockRecordNew2QainyiInventory(StockRecordNewDto stockRecordPageRes);

    OrderOutputVo outputDto2ExportVo(OrderOutputExportDto orderOutputExportDto);

    @Mappings({@Mapping(source = "orderOutputExportDto.packageLength", target = "length"),
            @Mapping(source = "orderOutputExportDto.packageWidth", target = "width"),
            @Mapping(source = "orderOutputExportDto.packageTrackNumber", target = "trackNumber"),
            @Mapping(source = "orderOutputExportDto.packageHeight", target = "height"),
            @Mapping(source = "orderOutputExportDto.packageWeight", target = "weight")})
    OrderOutPackageVo orderCostDto2PackageExportVo(OrderOutputExportDto orderOutputExportDto);

    OrderOutProductVo orderCostDto2ProductExportVo(ProductInfoDo productInfoDo);
    OrderBackDetailExportVo backPage2export(OrderBackPageRes orderBackPageRes);

    OrderInputSkuExport inputMarkProduct2export(InputMarkProduct inputMarkProduct);

}
